{

    /**
     * as 强制类型转化
     */

    const body = document.querySelector('body'); // ==> const body: HTMLBodyElement | null

    const body1 = document.querySelector('body') as HTMLBodyElement;
    // 简写为
    const body2 = <HTMLBodyElement>document.querySelector('body');
}


{   

    /**
     *  as const: 将表达式变为，不可修改的字面量（literal）类型
     *  不可变：被readonly修饰，且定义的值不可被改变
     */

    // 数组变为被readonly修饰的元组值类型
    const arr = [12, "age"] as const;
    arr[0] = '23';

    // 对象的中的所有成员变为不可修改的值类型
    const req = { url: "https://example.com", method: "GET", success() {} } as const;
    req.method = 'post'

    // 字符串的类型:'str'
    const str = 'str' as const;
}

{
    /**
     * 重映射
     * type MappedTypeWithNewProperties<Type> = {
     *     [Properties in keyof Type as NewKeyType]: Type[Properties]
     * }
     *  */
    // 参考链接： https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#mapping-modifiers
}



